const { bannerModel } = require('../models/model/banner');

exports.findBannerService = async function () {
	let res = await bannerModel.findAll();
	return JSON.parse(JSON.stringify(res));
};

exports.updateBannerService = async function (data) {
	// 全部删除
	await bannerModel.destroy({
		truncate: true
	});
	// 重新添加
	let res = await bannerModel.bulkCreate(data);

	return JSON.parse(JSON.stringify(res));
};
